/* BoLe智能HR系统 - 布局修复补丁 */
/* 解决界面尺寸、组件遮挡和屏幕溢出问题 */

/* 确保根容器正确处理视口大小 */
html {
    height: 100%;
    overflow-x: hidden;
}

body {
    height: 100%;
    overflow-x: hidden;
    min-height: 100vh;
}

/* 修复 Living Workspace 布局问题 */
.living-workspace {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* 修复主内容区域的网格布局 */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(280px, 380px) 1fr minmax(300px, 400px);
    gap: 0;
    overflow: hidden;
    height: calc(100vh - 80px); /* 减去header高度 */
    min-height: 0; /* 确保网格项目能够缩小 */
}

/* 修复候选人工作台尺寸问题 */
.candidate-workbench {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    overflow-y: auto;
    max-height: 100%;
    min-width: 280px;
    width: 100%;
}

/* 修复工作台控制区域的换行问题 */
.workbench-controls {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    flex-wrap: wrap;
    flex-direction: column;
}

.workbench-controls .btn,
.workbench-controls select {
    width: 100%;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 修复对话核心区域 */
.conversation-core {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0; /* 允许内容缩小 */
    height: 100%;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    min-height: 0; /* 确保能够滚动 */
}

/* 修复深度信息面板 */
.deep-info-panel {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 100%;
    min-width: 300px;
    width: 100%;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    min-height: 0;
}

/* 修复HR Dashboard的响应式问题 */
.main-content.dashboard {
    display: flex;
    min-height: calc(100vh - 80px);
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* 修复侧边栏尺寸 */
.sidebar {
    width: 100%;
    max-width: 320px;
    min-width: 280px;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin: 1rem 0;
    height: fit-content;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    flex-shrink: 0;
}

/* 修复内容区域 */
.content-area {
    flex: 1;
    margin: 1rem 0;
    min-width: 0; /* 允许内容缩小 */
    overflow-x: hidden;
}

/* 修复概览卡片网格 */
.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

/* 修复图表网格 */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1rem;
}

/* 修复模态框的尺寸问题 */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    overflow-y: auto; /* 添加滚动支持 */
}

.chart-modal-content,
.candidate-modal-content {
    position: relative;
    margin: 2rem auto;
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 4rem);
    overflow: auto;
}

.chart-modal-content {
    width: min(800px, 90vw);
    height: min(600px, 80vh);
}

.candidate-modal-content {
    width: min(700px, 90vw);
    min-height: min(500px, 70vh);
}

/* 修复聊天输入区域 */
.chat-input-area {
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
    padding: 1rem;
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    resize: none;
    padding: 0.75rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    line-height: 1.4;
}

/* 修复按钮样式和尺寸 */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    min-height: 40px;
    text-align: center;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    min-height: 32px;
}

.btn-icon {
    padding: 0.5rem;
    min-width: 40px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 响应式断点修复 */

/* 大屏幕 (>1200px) - 保持三列布局 */
@media (min-width: 1201px) {
    .main-content {
        grid-template-columns: 380px 1fr 400px;
    }
}

/* 中等屏幕 (768px - 1200px) - 调整比例 */
@media (max-width: 1200px) and (min-width: 769px) {
    .main-content {
        grid-template-columns: 300px 1fr 320px;
        gap: 0.5rem;
    }
    
    .sidebar {
        width: 100%;
        max-width: 280px;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .overview-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 平板屏幕 (481px - 768px) - 两列布局 */
@media (max-width: 768px) and (min-width: 481px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        gap: 0;
        padding: 0 0.5rem;
    }
    
    .candidate-workbench {
        order: 1;
        height: 200px;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }
    
    .conversation-core {
        order: 2;
    }
    
    .deep-info-panel {
        order: 3;
        border-left: none;
        border-top: 1px solid var(--border-light);
        max-height: 300px;
    }
    
    .overview-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .workbench-controls {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .workbench-controls .btn,
    .workbench-controls select {
        width: auto;
        flex: 1;
        min-width: 100px;
    }
}

/* 手机屏幕 (≤480px) - 单列布局 */
@media (max-width: 480px) {
    .workspace-header {
        padding: 0.5rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .title {
        font-size: 1.4rem;
    }
    
    .header-controls {
        gap: 0.3rem;
    }
    
    .main-content {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        gap: 0;
        padding: 0;
        height: calc(100vh - 120px);
    }
    
    .candidate-workbench {
        order: 1;
        height: 150px;
        max-height: 150px;
        border: none;
        border-bottom: 1px solid var(--border-light);
    }
    
    .deep-info-panel {
        order: 2;
        height: 200px;
        max-height: 200px;
        border: none;
        border-bottom: 1px solid var(--border-light);
    }
    
    .conversation-core {
        order: 3;
        border: none;
    }
    
    .overview-cards {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .sidebar {
        width: 100%;
        max-width: none;
        margin: 0.5rem 0;
        border-radius: 8px;
    }
    
    .content-area {
        margin: 0.5rem 0;
    }
    
    .chart-modal-content,
    .candidate-modal-content {
        width: calc(100vw - 1rem);
        height: calc(100vh - 2rem);
        margin: 0.5rem;
        border-radius: 8px;
    }
    
    .workbench-controls {
        flex-direction: column;
        gap: 0.3rem;
    }
    
    .workbench-controls .btn,
    .workbench-controls select {
        width: 100%;
        font-size: 0.8rem;
        padding: 0.4rem;
    }
    
    .chat-input-area {
        padding: 0.5rem;
    }
    
    .input-wrapper {
        gap: 0.3rem;
    }
    
    .chat-input {
        padding: 0.5rem;
        font-size: 0.9rem;
    }
}

/* 修复滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--border-light);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark, #5a6fd8);
}

/* 修复表格和列表的响应式 */
.candidate-card {
    margin-bottom: 0.8rem;
    padding: 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.candidate-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.candidate-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

/* 确保所有交互元素有足够的点击区域 */
.btn, button, select, input[type="text"], input[type="email"], textarea {
    min-height: 44px; /* WCAG推荐的最小点击目标 */
}

/* 修复文本溢出 */
.candidate-name,
.job-title,
.section-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 修复长文本内容 */
.resume-content,
.analysis-content,
.chat-message-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* 防止图像和图表溢出 */
img, canvas, svg {
    max-width: 100%;
    height: auto;
}

.chart-container {
    position: relative;
    overflow: hidden;
    min-height: 200px;
    max-height: 400px;
}

/* 修复Toast通知的位置 */
.toast {
    position: fixed;
    top: 100px;
    right: 1rem;
    left: auto;
    max-width: calc(100vw - 2rem);
    width: auto;
    min-width: 250px;
    z-index: 2500;
}

@media (max-width: 480px) {
    .toast {
        right: 0.5rem;
        top: 80px;
        max-width: calc(100vw - 1rem);
    }
}

/* 修复加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.loading-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    max-width: 90vw;
    max-height: 90vh;
}

/* 确保所有浮动元素正确清除 */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* 修复Flex容器的溢出问题 */
.flex-container {
    display: flex;
    min-width: 0;
}

.flex-item {
    flex: 1;
    min-width: 0;
}

/* 最终保险措施 - 防止任何元素超出视口 */
* {
    max-width: 100%;
}

/* 专门针对hr_interface.html的修复 */
.main-container {
    display: flex;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

.candidate-list {
    width: 100%;
    max-width: 300px;
    min-width: 250px;
    flex-shrink: 0;
    overflow-y: auto;
    background: #f8f9fa;
    border-right: 2px solid #e9ecef;
}

.main-content.interface {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.content-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #ffffff;
}

/* 响应式调整 hr_interface.html */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    
    .candidate-list {
        width: 100%;
        max-width: none;
        height: 200px;
        max-height: 200px;
    }
    
    .main-content.interface {
        flex: 1;
        min-height: calc(100vh - 200px);
    }
}





